<div class="main-container col1-layout">
    <div class="main">
        <div class="col-main">
<?php
$this->breadcrumbs=array(
	'Goods'=>array('index'),
	'Manage',
);

$this->menu=array(
	array('label'=>'List Goods', 'url'=>array('index')),
	array('label'=>'Create Goods', 'url'=>array('create')),
);

Yii::app()->clientScript->registerScript('goods/search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('goods-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1>Manage Goods</h1>

<p>
You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>

<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('/goods/_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'goods-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		'goods_id',
		'goods_name',
		'goods_price',
		'goods_discount',
		'goods_type_id',
		'goods_type_name',
		/*
		'add_time',
		'goods_pictrues',
		'status',
		'average_score',
		*/
		array(
			'class'=>'CButtonColumn',
				'header'=>'operate',
				'template'=>'{view} {Add to cart}',
				'buttons'=>array(
			'Add to cart'=>array(
					'label'=>'Add to cart',
					'url'=>'Yii::app()->controller->createUrl("cart/create",array("id"=>$data->goods_id))',
// 					'ajax'=>'array(
// 					"type"=>"POST",
// 					"url"=>"Yii::app()->controller->createUrl(\"cart/sent\",array(\"id\"=>$data->primaryKey))",
// 					"update"=>".summary",
//					)',
			)),
		),
	),
)); ?>
</div>
</div>
</div>
